<?php
include_once "src/controller/regmanagement/AdminManager.php";
include_once "src/controller/regmanagement/MiscellaneousManager.php";
include_once "src/model/Consultant.php";
include_once "src/regexception/DBConnectionException.php";
include_once "src/regexception/DBException.php";
include_once "src/regexception/GeneralRegistryException.php";

try {
    $consultants = AdminManager::getConsultantsAccountInformation($_POST["firstName"], $_POST["lastName"], $_POST["email"]);

    if (count($consultants) == 0) {
?>
        <div style="padding-top:10px;padding-bottom:10px;text-align:center;font-weight:bold;">
            0 results.
        </div>
<?php
    }

    for ($i = 0 ; $i < count($consultants) ; $i++) {
        $consultant = $consultants[$i];
?>
        <div id="user<?php echo $consultant->getConsultantId(); ?>"
             style="float:left;padding:5px;text-align:left;background-color:#FFFFFF;border-bottom:1px solid #CCCCCC;">
            <input type="hidden"
                   id="userFirstName<?php echo $consultant->getConsultantId(); ?>"
                   name="userFirstName<?php echo $consultant->getConsultantId(); ?>"
                   value="<?php echo $consultant->getFirstName(); ?>" />
            <input type="hidden"
                   id="userLastName<?php echo $consultant->getConsultantId(); ?>"
                   name="userLastName<?php echo $consultant->getConsultantId(); ?>"
                   value="<?php echo $consultant->getLastName(); ?>" />
            <input type="hidden"
                   id="userEmail<?php echo $consultant->getConsultantId(); ?>"
                   name="userEmail<?php echo $consultant->getConsultantId(); ?>"
                   value="<?php echo $consultant->getEmail(); ?>" />
            <div id="userFullNameLabel<?php echo $consultant->getConsultantId(); ?>"
                 style="float:left;width:200px;overflow:hidden;">
                <?php echo $consultant->getFirstName() . " " . $consultant->getLastName(); ?>
            </div>
            <div id="userEmailLabel<?php echo $consultant->getConsultantId(); ?>"
                 style="float:left;width:210px;overflow:hidden;margin-left:10px;">
                <?php echo $consultant->getEmail(); ?>
            </div>
            <div id="userCompanyNameLabel<?php echo $consultant->getConsultantId(); ?>"
                 style="float:left;width:250px;overflow:hidden;margin-left:10px;">
                <?php echo $consultant->getCompanyName(); ?>
            </div>
            <div style="float:right;">
                <img src="images/icons/editIcon_1.png"
                     style="cursor:pointer;"
                     onclick="javascript:showModifyUserAccountDialog(<?php echo $consultant->getConsultantId(); ?>)"/>
            </div>
        </div>
<?php
    }
} catch (Exception $e) {
    echo $e->getMessage();
}
?>